<extend name='Index:index'/>
<block name='ad'></block>
<block name='title'></block>
<block name='head'></block>
<block name='floor'>
	<!-- 页面详情 -->
	<div class="panel panel-primary">
	  <div class="panel-heading">
	  	<div class="row">
	  		<h3 class="col-md-2 panel-title">我的购物车</h3>
	  	</div>
	  </div>
	  <form action="<{:U('ShopCart/payAll')}>" method='post'>
	  <div class="panel-body ">
	  		<table class="table table-bordered">
	  			<tr class='warning'>
	  				<th class="text-center">商品</th>
	  				<th class="text-center">图片</th>
	  				<th class="text-center">价格</th>
	  				<th class="text-center">库存</th>
	  				<th class="text-center">数量</th>
	  				<th class="text-center">合计</th>
	  				<th class="text-center">删除</th>
	  			</tr>
	  			<volist name="shoprows" id='shoprow'>
	  			<tr>
	  				<td class="text-center" style="line-height: 150px;"><{$shoprow['name']}></td>
	  				<td class="text-center" style="line-height: 150px;"><img src="__PUBLIC__/upload/shop/t_<{$shoprow['img']}>"></td>
	  				<td class="text-center" style="line-height: 150px;"><{$shoprow['price']}>元</td>
	  				<td class="text-center" style="line-height: 150px;"><{$shoprow['stock']}></td>
	  				<td class="text-center" style="line-height: 150px;">
	  					<a class="btn btn-default btn-sm"  href="<{:U('ShopCart/cut','','')}>/id/<{$shoprow['id']}>">-</a>
	  					<{$shoprow['num']}>
	  					<a class="btn btn-default btn-sm" href="<{:U('ShopCart/add','','')}>/id/<{$shoprow['id']}>">+</a>
	  				</td>
	  				<td class="text-center" style="line-height: 150px;"><?php echo $shoprow['price']*$shoprow['num']?>元</td>
	  				<td class="text-center" style="line-height: 150px;"><a href="<{:U('ShopCart/delete','','')}>/id/<{$shoprow['id']}>" class="btn btn-danger">删除</a></td>
	  			</tr>
	  			<!-- 计算购物车总金额 -->
	  			<?php
	  				$tot += $shoprow['price']*$shoprow['num'];
	  			?>
	  			</volist>
	  		</table>
	  		<div class="row" style="padding:5px;">
	  			<span class="col-md-3 text-right"><a href="<{:U('Index/index')}>"  class="btn btn-info">继续购物</a></span>
	  			<span class="col-md-3 "><a href="<{:U('ShopCart/delAll')}>" class="btn btn-danger">全部删除</a></span>
	  			<span class="col-md-4 text-center"><b>总计</b><{$tot?$tot:0}> <b>元</b></span>
	  			<span class="col-md-2 text-center"> <input type="submit" class="btn btn-info" value="提交订单"></span>
	  		</div>
			<div class="panel panel-info">
				<div class="panel-heading">
					<h4 class="panel-title">我的联系方式</h4>
				</div>
				<div class="panel-body">
					<if condition="$_SESSION['home_username']">
						<table class="table table-bordered">
							<tr>
								<th>选择</th>
								<th>姓名</th>
								<th>地址</th>
								<th>电话</th>
								<th>邮箱</th>
							</tr>
							<volist name='touchrows' id='touchrow' key='i'>
							<if condition="$i eq 1" > <!-- 默认选中第一个 -->
							<tr>
								<td><input type="radio" name="touch" checked="checked" value="<{$touchrow['id']}>" ></td>
								<td><{$touchrow['name']}></td>
								<td><{$touchrow['add']}></td>
								<td><{$touchrow['tel']}></td>
								<td><{$touchrow['email']}></td>
							</tr>
							<else/>
							<tr>
								<td><input type="radio" name="touch"  value="<{$touchrow['id']}>" ></td>
								<td><{$touchrow['name']}></td>
								<td><{$touchrow['add']}></td>
								<td><{$touchrow['tel']}></td>
								<td><{$touchrow['email']}></td>
							</tr>
							</if>
							</volist>
						</table>
					<else/>
						<p>请先<b><a href="<{:U('Login/index')}>">登陆</a></b></p>
					</if>
				</div>
			</div>
	  </div>
	  </form>
	</div>
	<!-- 页面详情   结束-->
</block>
